import java.util.ArrayList;
import java.util.List;

/**
 * @author : cww
 * @date : 2021/1/25 16:09
 */
public class NewsPaper implements Subject{
    private List<Observer> observerList;
    public NewsPaper(){
        observerList = new ArrayList<>();
    }
    @Override
    public void add(Observer observer) {
        observerList.add(observer);
    }

    @Override
    public void remove(Observer observer) {
        observerList.remove(observer);
    }

    @Override
    public void notice(String txt) {
        observerList.forEach(t->{
            t.update(txt);
        });
    }
}
